import { login } from '@/api/user'

export default {
  namespaced: true,
  state: {
    userInfo: {},
    token: ''
  },
  getters: {
    userName: (state) => {
      return state.userInfo.name
    }
  },
  mutations: {
    FreshUser: (state, userInfo) => {}
  },
  actions: {
    Login({ commit }, { account, password }) {
      login({ account, password }).then((res) => {
        if (res.data) {
          commit('freshPopupKeys', {})
        }
      })
    }
  }
}
